﻿namespace VAdvantage.Model
{

    /** Generated Model - DO NOT CHANGE */
    using System;
    using System.Text;
    using VAdvantage.DataBase;
    using VAdvantage.Common;
    using VAdvantage.Classes;
    using VAdvantage.Process; using VAdvantage.ProcessEngine;
    using VAdvantage.Model;
    using VAdvantage.Utility;
    using System.Data;
    /** Generated Model for APPOINTMENTS
     *  @author Jagmohan Bhatt (generated) 
     *  @version Vienna Framework 1.1.1 - $Id$ */
    public class X_APPOINTMENTS : PO
    {
        public X_APPOINTMENTS(Context ctx, int APPOINTMENTS_ID, String trxName)
            : base(ctx, APPOINTMENTS_ID, trxName)
        {
            /** if (APPOINTMENTS_ID == 0)
            {
            SetAppointments_ID (0);
            }
             */
        }
        public X_APPOINTMENTS(Ctx ctx, int APPOINTMENTS_ID, String trxName)
            : base(ctx, APPOINTMENTS_ID, trxName)
        {
            /** if (APPOINTMENTS_ID == 0)
            {
            SetAppointments_ID (0);
            }
             */
        }
        /** Load Constructor 
        @param ctx context
        @param rs result set 
        @param trxName transaction
        */
        public X_APPOINTMENTS(Context ctx, DataRow rs, String trxName)
            : base(ctx, rs, trxName)
        {
        }
        /** Load Constructor 
        @param ctx context
        @param rs result set 
        @param trxName transaction
        */
        public X_APPOINTMENTS(Ctx ctx, DataRow rs, String trxName)
            : base(ctx, rs, trxName)
        {
        }
        /** Load Constructor 
        @param ctx context
        @param rs result set 
        @param trxName transaction
        */
        public X_APPOINTMENTS(Ctx ctx, IDataReader dr, String trxName)
            : base(ctx, dr, trxName)
        {
        }
        /** Serial Version No */
        static long serialVersionUID = 27554991982170L;
        /** Last Updated Timestamp 5/3/2010 11:34:25 AM */
        public static long updatedMS = 1272866665381L;
        /** AD_Table_ID=1000022 */
        public static int Table_ID = 1000022;

        /** TableName=APPOINTMENTS */
        public static String Table_Name = "APPOINTMENTS";

        protected static KeyNamePair model = new KeyNamePair(1000022, "APPOINTMENTS");

        protected Decimal accessLevel = new Decimal(4);
        /** AccessLevel
        @return 4 - System 
        */
        protected override int Get_AccessLevel()
        {
            return Convert.ToInt32(accessLevel.ToString());
        }
        /** Load Meta Data
        @param ctx context
        @return PO Info
        */
        protected override POInfo InitPO(Context ctx)
        {
            POInfo poi = POInfo.GetPOInfo(ctx, Table_ID);
            return poi;
        }
        /** Load Meta Data
        @param ctx context
        @return PO Info
        */
        protected override POInfo InitPO(Ctx ctx)
        {
            POInfo poi = POInfo.GetPOInfo(ctx, Table_ID);
            return poi;
        }
        /** Info
        @return info
        */
        public override String ToString()
        {
            StringBuilder sb = new StringBuilder("X_APPOINTMENTS[").Append(Get_ID()).Append("]");
            return sb.ToString();
        }
        /** Set User/Contact.
        @param AD_User_ID User within the system - Internal or Business Partner Contact */
        public void SetAD_User_ID(int AD_User_ID)
        {
            if (AD_User_ID <= 0) Set_Value("AD_User_ID", null);
            else
                Set_Value("AD_User_ID", AD_User_ID);
        }
        /** Get User/Contact.
        @return User within the system - Internal or Business Partner Contact */
        public int GetAD_User_ID()
        {
            Object ii = Get_Value("AD_User_ID");
            if (ii == null) return 0;
            return Convert.ToInt32(ii);
        }
        /** Set ALLDAY.
        @param ALLDAY ALLDAY */
        public void SetALLDAY(Boolean ALLDAY)
        {
            Set_Value("ALLDAY", ALLDAY);
        }
        /** Get ALLDAY.
        @return ALLDAY */
        public Boolean IsALLDAY()
        {
            Object oo = Get_Value("ALLDAY");
            if (oo != null)
            {
                if (oo.GetType() == typeof(bool)) return Convert.ToBoolean(oo);
                return "Y".Equals(oo);
            }
            return false;
        }

        /** Set ALLDAY.
        @param ALLDAY ALLDAY */
        public void SetISREAD(Boolean ALLDAY)
        {
            Set_Value("ISREAD", ALLDAY);
        }
        /** Get ALLDAY.
        @return ALLDAY */
        public Boolean ISREAD()
        {
            Object oo = Get_Value("ISREAD");
            if (oo != null)
            {
                if (oo.GetType() == typeof(bool)) return Convert.ToBoolean(oo);
                return "Y".Equals(oo);
            }
            return false;
        }


        /** Set Appointments_ID.
        @param Appointments_ID Appointments_ID */
        public void SetAppointments_ID(int Appointments_ID)
        {
            if (Appointments_ID < 1) throw new ArgumentException("Appointments_ID is mandatory.");
            Set_ValueNoCheck("Appointments_ID", Appointments_ID);
        }
        /** Get Appointments_ID.
        @return Appointments_ID */
        public int GetAppointments_ID()
        {
            Object ii = Get_Value("Appointments_ID");
            if (ii == null) return 0;
            return Convert.ToInt32(ii);
        }
        /** Set Description.
        @param Description Optional short description of the record */
        public void SetDescription(String Description)
        {
            if (Description != null && Description.Length > 4000)
            {
                log.Warning("Length > 4000 - truncated");
                Description = Description.Substring(0, 4000);
            }
            Set_Value("Description", Description);
        }
        /** Get Description.
        @return Optional short description of the record */
        public String GetDescription()
        {
            return (String)Get_Value("Description");
        }
        /** Set End Date.
        @param EndDate Last effective date (inclusive) */
        public void SetEndDate(DateTime? EndDate)
        {
            Set_ValueNoCheck("EndDate", (DateTime?)EndDate);
        }
        /** Get End Date.
        @return Last effective date (inclusive) */
        public DateTime? GetEndDate()
        {
            return (DateTime?)Get_Value("EndDate");
        }
        /** Set ISPRIVATE.
        @param ISPRIVATE ISPRIVATE */
        public void SetISPRIVATE(bool ISPRIVATE)
        {
            Set_Value("ISPRIVATE", ISPRIVATE);
        }
        /** Get ISPRIVATE.
        @return ISPRIVATE */
        public bool IsPRIVATE()
        {
            Object oo = Get_Value("ISPRIVATE");
            if (oo != null)
            {
                if (oo.GetType() == typeof(bool)) return Convert.ToBoolean(oo);
                return "Y".Equals(oo);
            }
            return false;
        }
        /** Set LABEL.
        @param LABEL LABEL */
        public void SetLABEL(Decimal? LABEL)
        {
            Set_Value("LABEL", (Decimal?)LABEL);
        }
        /** Get LABEL.
        @return LABEL */
        public Decimal GetLABEL()
        {
            Object bd = Get_Value("LABEL");
            if (bd == null) return Envs.ZERO;
            return Convert.ToDecimal(bd);
        }
        /** Set LOCATION.
        @param LOCATION LOCATION */
        public void SetLOCATION(String LOCATION)
        {
            if (LOCATION != null && LOCATION.Length > 60)
            {
                log.Warning("Length > 60 - truncated");
                LOCATION = LOCATION.Substring(0, 60);
            }
            Set_Value("LOCATION", LOCATION);
        }
        /** Get LOCATION.
        @return LOCATION */
        public String GetLOCATION()
        {
            return (String)Get_Value("LOCATION");
        }
        /** Set RECURRENCEINFO.
        @param RECURRENCEINFO RECURRENCEINFO */
        public void SetRECURRENCEINFO(String RECURRENCEINFO)
        {
            if (RECURRENCEINFO != null && RECURRENCEINFO.Length > 4000)
            {
                log.Warning("Length > 4000 - truncated");
                RECURRENCEINFO = RECURRENCEINFO.Substring(0, 4000);
            }
            Set_Value("RECURRENCEINFO", RECURRENCEINFO);
        }
        /** Get RECURRENCEINFO.
        @return RECURRENCEINFO */
        public String GetRECURRENCEINFO()
        {
            return (String)Get_Value("RECURRENCEINFO");
        }
        /** Set REMINDERINFO.
        @param REMINDERINFO REMINDERINFO */
        public void SetREMINDERINFO(String REMINDERINFO)
        {
            if (REMINDERINFO != null && REMINDERINFO.Length > 4000)
            {
                log.Warning("Length > 4000 - truncated");
                REMINDERINFO = REMINDERINFO.Substring(0, 4000);
            }
            Set_Value("REMINDERINFO", REMINDERINFO);
        }
        /** Get REMINDERINFO.
        @return REMINDERINFO */
        public String GetREMINDERINFO()
        {
            return (String)Get_Value("REMINDERINFO");
        }
        /** Set Start Date.
        @param StartDate First effective day (inclusive) */
        public void SetStartDate(DateTime? StartDate)
        {
            Set_ValueNoCheck("StartDate", (DateTime?)StartDate);
        }
        /** Get Start Date.
        @return First effective day (inclusive) */
        public DateTime? GetStartDate()
        {
            return (DateTime?)Get_Value("StartDate");
        }
        /** Set Status.
        @param Status Status of the currently running check */
        public void SetStatus(Decimal? Status)
        {
            Set_Value("Status", (Decimal?)Status);
        }
        /** Get Status.
        @return Status of the currently running check */
        public Decimal GetStatus()
        {
            Object bd = Get_Value("Status");
            if (bd == null) return Envs.ZERO;
            return Convert.ToDecimal(bd);
        }
        /** Set Subject.
        @param Subject Email Message Subject */
        public void SetSubject(String Subject)
        {
            if (Subject != null && Subject.Length > 60)
            {
                log.Warning("Length > 60 - truncated");
                Subject = Subject.Substring(0, 60);
            }
            Set_Value("Subject", Subject);
        }
        /** Get Subject.
        @return Email Message Subject */
        public String GetSubject()
        {
            return (String)Get_Value("Subject");
        }
        /** Set Code Type.
        @param Type Type of Code/Validation (SQL, Java Script, Java Language) */
        public void SetType(Decimal? Type)
        {
            Set_Value("Type", (Decimal?)Type);
        }
        /** Get Code Type.
        @return Type of Code/Validation (SQL, Java Script, Java Language) */
        public Decimal GetType()
        {
            Object bd = Get_Value("Type");
            if (bd == null) return Envs.ZERO;
            return Convert.ToDecimal(bd);
        }
    }

}
